package com.example.democ.service.impl;


import com.alibaba.dubbo.rpc.RpcContext;
import com.example.democ.service.UserService;
import org.springframework.stereotype.Component;

import java.util.Random;


@com.alibaba.dubbo.config.annotation.Service
@Component
public class UserServiceImpl implements UserService {


    @Override
    public String test(){
         String ip = (String) RpcContext.getContext().getAttachment("ip");
         System.out.println("========"+ip);
        return "test demo C------"+ip;
    }


    @Override
    public String testA() throws InterruptedException {
         int i = new Random().nextInt(100);
         Thread.sleep(i);
        return "test demo C------A";
    }

    @Override
    public String testB() throws InterruptedException {
        int i = new Random().nextInt(100);
        Thread.sleep(i);
        return "test demo C------B";
    }


    @Override
    public String testC() throws InterruptedException {
        int i = new Random().nextInt(100);
        Thread.sleep(i);
        return "test demo C------C";
    }


}
